import {Table, Column, Model, Index, DataType ,HasMany} from "sequelize-typescript";
import {Like} from "./like";
import {Comment} from "./comment";

@Table({
    tableName: 'dynamic'
})
export class Dynamic extends Model<Dynamic> {
    @Column
    user_id!: string

    @Column
    user_name!: string

    @Column
    user_picture!: string

    @Column
    dy_category!: number // 动态类型 枚举

    @Column({
        type: DataType.TEXT,
    })
    dy_content!: string

    @Column
    dy_img!: string

    // @Column
    // dy_like!: string  // 点赞表 外键
    //
    // @Column
    // dy_comment!: string //动态评论 外键

    @Column({
        type: DataType.BIGINT({length: 20}),
    })
    created_at!: number

    @HasMany(()=>Like) dy_like!: Like[]
    @HasMany(()=>Comment) dy_comment!: Comment[]
}
